package open.tech.dawn.rest.common.page;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import java.util.List;

/**
 * 分页结果的封装(for LayUI Table)
 * @param <T>
 */
public class PageInfo<T> {

    // 结果集
    private List<T> data;

    //总数
    private Long count;

    private Integer code;

    private String msg;

    public PageInfo(Page<T> page) {
        this.data = page.getRecords();
        this.count = page.getTotal();
        this.code = 0;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

}
